package study.transaction.seata.support.datasource;

import com.alibaba.druid.pool.DruidDataSource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

@Slf4j
@Configuration
public class DataSourceConfig {

    @Bean("user_ds")
    @ConfigurationProperties("datasource.user")
    public DataSource user() {
        DruidDataSource dataSource = new DruidDataSource();
        return dataSource;
    }

    @Bean("account_ds")
    @ConfigurationProperties("datasource.account")
    public DataSource account() {
        DruidDataSource dataSource = new DruidDataSource();
        return dataSource;
    }
}
